﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

public partial class VolunteerInvigilation : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SqlConnection conn;
            string connectionString = ConfigurationManager.ConnectionStrings["ExamScheduleDBConString"].ConnectionString;
            conn = new SqlConnection(connectionString);
            SqlCommand comm = new SqlCommand("sp_getInvigilationRequestsByProfID", conn);
            comm.CommandType = System.Data.CommandType.StoredProcedure;
            comm.Parameters.Add("@profName",
               System.Data.SqlDbType.Text);
            comm.Parameters["@profName"].Value = Session["UserName"];
            SqlDataReader reader;

            try
            {
                conn.Open();
                reader = comm.ExecuteReader();
                gridMyInvigilations.DataSource = reader;
                gridMyInvigilations.DataBind();

            }
            finally
            {
                conn.Close();
            }
        }
    }
    protected void selectRow(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {
            SqlConnection conn;
            string connectionString = ConfigurationManager.ConnectionStrings["ExamScheduleDBConString"].ConnectionString;
            conn = new SqlConnection(connectionString);
        }
        else if (e.CommandName == "Cancel")
        {
            SqlConnection conn;
            string connectionString = ConfigurationManager.ConnectionStrings["ExamScheduleDBConString"].ConnectionString;
            conn = new SqlConnection(connectionString);
            SqlCommand comm = new SqlCommand("UPDATE       ExamDetails SET Additional_InvigilationRequested = 0, RequestFulfilled = 0 WHERE        ExamID = ",conn);
        }
    }
}